package handler

import (
	"chat/chat-box/initernal/dto"
	"chat/chat-box/initernal/model"
	"chat/chat-box/response"
	"github.com/gin-gonic/gin"
	"strconv"
)

func FindChat(c *gin.Context) {

	var chat model.Chat
	uid := c.Query("user_id")
	atoi, err := strconv.Atoi(uid)
	if err != nil {
		return
	}
	chat.UserId = atoi
	err = dto.FindChat(&chat, chat.UserId)
	if err != nil {
		response.Error(c, "查询失败")
		return
	}
	response.Success(c, "查询成功", &chat)
}
